<?php
class IndexAction extends Action {

    public function _initialize() {
        $Setting = M('Setting');
        $setting = $Setting->find(1);
        
        $this->assign('setting', $setting);
    }
    
    public function index() {
        $Article = M('Article');
        
        $thumb_news = $Article->where(array('thumb' => array('neq', '')))->order(array('add_time' => 'desc'))->limit(5)->select();
        $this->assign('thumb_news', $thumb_news);
        
        $news = $Article->where(array('cat_id' => 11))->order(array('article_id' => 'desc'))->limit(5)->select();
        $affairs = $Article->where(array('cat_id' => 12))->order(array('article_id' => 'desc'))->limit(5)->select();
        $notice = $Article->where(array('cat_id' => 13))->order(array('article_id' => 'desc'))->limit(10)->select();
        
        $this->assign('news', $news);
        $this->assign('affairs', $affairs);
        $this->assign('notice', $notice);
        
        $Link = M('Link');
        $link = $Link->order(array('list_order' => 'asc'))->select();
        $this->assign('link', $link);
        $this->display();
    }
    
    /* 校长信箱 */
    public function mailbox() {
        $Setting = M('Setting');
        $setting = $Setting->find(1);
        $this->assign('mailbox', $setting['mailbox']);
        $this->display();
    }

    /**
    +----------------------------------------------------------
    * 探针模式
    +----------------------------------------------------------
    */
    public function checkEnv() {
        load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
        $env_table = check_env();//根据当前函数获取当前环境
        echo $env_table;
    }
    
}
?>